// 子组件中
<template>
  <div class="com_a">
    <div>我是子组件</div>
    <input v-model="message" />
    <p style="padding:24px 0">获取父组件的值为: {{parentVal}}</p>
    <div></div>
  </div>
</template>
 
<script>
export default {
  data() {
    return {
      message: "我是子组件的值"
    };
  },
  computed: {
    parentVal() {
      return this.$parent.msg;
    }
  }
};
</script>
<style scoped>
input {
  padding: 8px;
  border-radius: 5px;
  border: 2px solid blue;
  width: 300px;
}
</style>